<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>管理后台登录</title>
    <script type="text/javascript" src="/assets/js/jquery.min.js"></script>
</head>
<body>
<div>
    <div class="page-header">
        <h1> <small>管理系统后台登录</small></h1>
    </div>

    <form name="myform" method="post" action="/login" style="margin-top:200px;width:400px;margin-left:500px;">
        @csrf
        <div class="dl_one"><label>用户名：</label><input type="text" name="name" id="name" value=""></div><br>

        <div class="dl_two"><label>密  码：</label><input type="password" name="password" id="password" value=""></div><br>
        <div class="dl_btn">
            <input type="hidden" name="cookietime" value="0">
            <input type="hidden" name="forward" value="?">
            <input name="dosubmit" type="button" value="登录" class="btn_p" onclick="login()">
        </div>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
    function login(){
        var name=$("#name").val();
        var password=$("#password").val();
        $.post('/login',
            {'name':name,'password':password,'_token':'{{csrf_token()}}'},
            function (data){
                if (data.success){
                    alert(data.msg);
                    location.href='/adm';
                }else {
                    alert(data.msg);
                }
            },'json'
        );
    }
</script>
</body>
</html>

